const a: string = 'foo'
const b: number = 100
const c: boolean = false
//允许string、number、boolean为null或undefined，前提是tsconfig.json中strict为false
//const d: string = null 
const e: void = undefined
const f: null = null
const s: Symbol = Symbol()
//const error: string = 100
//数组类型
const arr1:Array<number> = [1,2,3]
const arr2: number[] = [2,3,4]
const sum = (...arg:number[])=>{
  arg.reduce((prev,current)=>{
    return prev + current
  },0)
}
//对象类型
const foo:object = ()=>{ } //[] {}
const obj: {bar:number,baz: string} = {bar: 12,baz: 'abc'}
//元组类型
const tuple:[number,string] = [18,'xiaoli']
// const age = tuple[0]
// const sname = tuple[1]
const [age,sname] = tuple
//Object.entries获取到的每一个元素就是一个元组
Object.entries({
  foo: 123,
  bar: 456
})
// const PostStatus ={
//   Draft: 0,
//   Unpublished: 1,
//   Published: 2
// }
enum PostStatus {
  Draft = 6,
  Unpublished,
  Published
}

